package com.aduerr.v1shouyin.mvp.activity;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.aduerr.v1shouyin.R;
import com.aduerr.v1shouyin.entity.IntegralEntity;


/**
 * @author HI
 * @email dev1024@foxmail.com
 * @time 2018/10/25 15:01
 * @change
 * @chang time
 * @class describe
 */

public class VipIntegralDetailActivity extends AppCompatActivity {

    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.iv_icon_type)
    ImageView ivIconType;
    @BindView(R.id.tv_result_type)
    TextView tvResultType;
    @BindView(R.id.tv_vip_name)
    TextView tvVipName;
    @BindView(R.id.tv_member_phone)
    TextView tvMemberPhone;
    @BindView(R.id.tv_change_int)
    TextView tvChangeInt;
    @BindView(R.id.tv_current_int)
    TextView tvCurrentInt;

    private int type = -1;//1:充值，2：使用
    private IntegralEntity.DataBean dataBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vip_integral_detail);
        ButterKnife.bind(this);
        initView();
    }

    void initView() {
        type = getIntent().getIntExtra("type", -1);
        dataBean = (IntegralEntity.DataBean) getIntent().getSerializableExtra("data");
        if(type == 1) {
            tvTitle.setText("充值结果");
            ivIconType.setImageResource(R.drawable.img_congzhi);
            tvResultType.setText("积分充值成功");
        } else if(type == 2) {
            tvTitle.setText("消费结果");
            ivIconType.setImageResource(R.drawable.img_xiaofei);
            tvResultType.setText("积分消费成功");
        }
        tvVipName.setText(dataBean.getName());
        tvMemberPhone.setText(dataBean.getPhone());
        tvChangeInt.setText(dataBean.getChangeInt() + "");
        tvCurrentInt.setText(dataBean.getIntegral() + "");
    }

    @OnClick({R.id.img_back, R.id.tv_comfirm})
    void Clicked(View v) {
        switch(v.getId()) {
            case R.id.img_back:
            case R.id.tv_comfirm:
                finish();
                break;
        }
    }
}
